package com.demo.mystudy.ui.jetinnofolder

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.demo.mystudy.R
import com.jetinno.simple.bean.FileBean
import java.io.File

/**
 * Created by zhangyuncai on 2025/4/28.
 * 描述：
 */
class JetinnoFolderAdapter(list: MutableList<FileBean>):BaseQuickAdapter<FileBean, BaseViewHolder>(R.layout.item_jetinnofolder_adapter,list) {
    override fun convert(helper: BaseViewHolder, item: FileBean) {
        val tv_jetinnofolder_filename=helper.getView<TextView>(R.id.tv_jetinnofolder_filename)
        tv_jetinnofolder_filename.setText(item.filePath)
        helper.setText(R.id.tv_jetinnofolder_filename,item.filePath)
        helper.setGone(R.id.ll_jetinnofolder_action,!item.isFolder)
        val file=File(mContext.filesDir,item.filePath)
        tv_jetinnofolder_filename.isSelected=file.exists()

        helper.addOnClickListener(R.id.tv_jetinnofolder_download)
        helper.addOnClickListener(R.id.tv_jetinnofolder_delete)
        helper.addOnClickListener(R.id.tv_jetinnofolder_edit)
    }
}